

package com.ehualu.impda.db;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class OracleUtills {



    public static String kkmc(String kkid) {


        Connection conn = DBConnection.getcon(2);

        String driver = ProFileConfig.driver;

        String jdbcurl = ProFileConfig.jdbcurl;
        String username = ProFileConfig.username;
        String password = ProFileConfig.password;

        Map<String, Double> info = new HashMap<String, Double>();
//        String strkkmc="";


        double dislong = 0;
//        Connection conn = null;
        Statement st = null;
        ResultSet rs = null;
        try {
            Class.forName(driver);

            // Setup the connection
//            conn = DriverManager.getConnection(jdbcurl, username, password);

            // Configure to be Read Only
            st = conn.createStatement();

            // Execute Query
//            String sql = "select * from v_kkxx where KKDM in ('%s','%s')"
            String sql = null;
//            select * from v_kkxx where (KKMC  like '%东昌路%' or KKMC like '%柳园路%' )and KKDM in ('3715000620','3715000621')
//            sql = String.format("select JD,WD from SKKXX where KKDM in ('%s','%s')", kkdm1, kkdm2);
            sql = String.format("select t.name as KKNM from cpkkxx t where id ='%s'", kkid);
//            String sql3=""
//            System.out.println("***********sql*******:" + sql);
            rs = st.executeQuery(sql);
            String strkkmc = "";

            int inum = 1;
            while (rs.next()) {
//
//                Double JD = rs.getDouble("JD");
//                Double WD = rs.getDouble("WD");
//                info.put("JD" + inum, JD);
//                info.put("WD" + inum, WD);
//                inum = inum + 1;


                strkkmc = rs.getString("KKNM");
//                System.out.println("*****rs.next strkkmc******:" + strkkmc);
            }

//            Double jd1 = info.get("JD1");
//
//            Double wd1 = info.get("WD1");
//            Double jd2 = info.get("JD2");
//
//            Double wd2 = info.get("WD2");
//
//            System.out.println("*****jd1******:" + jd1);
//            System.out.println("*****wd1******:" + wd1);
//            System.out.println("*****jd2******:" + jd2);
//            System.out.println("*****wd2******:" + wd2);
//
//            if (jd1 == 0 || wd1 == 0 || jd2 == 0 || wd2 == 0) {
//
//                dislong = 0;
//
//            } else {
//
//                dislong = DistanceUtils.getDistance(jd1, wd1, jd2, wd2);
//            }


//            System.out.println("*****strkkmc******:" + strkkmc);
            return strkkmc;

        } catch (ClassNotFoundException e) {
            e.printStackTrace();



        } catch (Exception e) {
            e.printStackTrace();

        } finally {
            if (rs != null) {
                try {
                    rs.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }

            if (st != null) {

                try {
                    st.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }

            }

//            if (conn != null) {
//
//                try {
//                    conn.close();
//                } catch (SQLException e) {
//                    e.printStackTrace();
//                }
//
//            }
        }

        return "";

    }

//    public static void main(String[] args) {
//
////        Connection conn = DBConnection.getehldb();
////        OracleUtills oracleUtills = new OracleUtills();
////        double ls = OracleUtills.dissize("3715000761", "3715000575");
//
//
//        String kk=OracleUtills.kkmc("37152400680004");
////        double ls = OracleUtills.realdislongm("3715000559", "3715000829");
////        double ls = OracleUtills.dissizet("3715000518", "3715000520");
////        for (int i = 1; i < 5; i++) {
//
////            OracleUtills.writeora("3715000653_3715000513" + i, "0.25477513389667844", "拥堵");
////        }
//
////
////        if (conn != null) {
////
////            try {
////                conn.close();
////            } catch (SQLException e) {
////                e.printStackTrace();
////            }
////
////        }
//
//        System.out.println(kk);
//
//    }
}
